command ::= ... |declModifiers`declModifiers` 是声明修饰符的集合,包括: * 文档注释 `/-- ... -/` * 属性列表 `@[attr1, attr2]` * 可见性说明符 `private` 或 `public` * `protected` * `noncomputable` * `unsafe` * `partial` 或 `nonrec` 所有修饰符都是可选的,并且必须按上述顺序出现。 `nestedDeclModifiers` 与 `declModifiers` 相同,但属性与声明打印在同一行;它用于嵌套在其他语法中的声明,例如结构体字段。inductiveIn Lean, every concrete type other than the universes and every type constructor other than dependent arrows is an instance of a general family of type constructions known as inductive types. It is remarkable that it is possible to construct a substantial edifice of mathematics based on nothing more than the type universes, dependent arrow types, and inductive types; everything else follows from those. Intuitively, an inductive type is built up from a specified list of constructors. For example, `List α` is the list of elements of type `α`, and is defined as follows: ``` inductive List (α : Type u) where | nil | cons (head : α) (tail : List α) ``` A list of elements of type `α` is either the empty list, `nil`, or an element `head : α` followed by a list `tail : List α`. See [Inductive types](https://lean-lang.org/theorem_proving_in_lean4/inductive_types.html) for more information.declId`declId` 匹配 `foo` 或 `foo.{u,v}`:一个标识符,后面可以跟一个宇宙名称列表。optDeclSig where (|`optDeclSig` 匹配类型可选的声明签名:先是一列绑定器,随后可以有 `: type`。declModifiers ident`declModifiers` 是声明修饰符的集合,包括: * 文档注释 `/-- ... -/` * 属性列表 `@[attr1, attr2]` * 可见性说明符 `private` 或 `public` * `protected` * `noncomputable` * `unsafe` * `partial` 或 `nonrec` 所有修饰符都是可选的,并且必须按上述顺序出现。 `nestedDeclModifiers` 与 `declModifiers` 相同,但属性与声明打印在同一行;它用于嵌套在其他语法中的声明,例如结构体字段。optDeclSig)* (deriving ident,*)?`optDeclSig` 匹配类型可选的声明签名:先是一列绑定器,随后可以有 `: type`。
声明一个新的归纳类型。
declModifiers 的含义可在 声明修饰词部分 查询。